package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

@Entity
public class Outbound {
    private long ouId;
    private String ouDanhao;
    private Employee employee;
    private Timestamp ouTime;
    private String ouShuoming;
    private List<WaouDetails> waouDetailsList;
    private String ouState;
    private DeliveryPlan deliveryPlanByPlanId;
    private String ouDesc;
    @Basic
    @Column(name="OU_DESC")
    public String getOuDesc() {
        return ouDesc;
    }

    public void setOuDesc(String ouDesc) {
        this.ouDesc = ouDesc;
    }

    @ManyToOne
    @JoinColumn(name = "plan_id", referencedColumnName = "plan_id")
    public DeliveryPlan getDeliveryPlanByPlanId() {
        return deliveryPlanByPlanId;
    }

    public void setDeliveryPlanByPlanId(DeliveryPlan deliveryPlanByPlanId) {
        this.deliveryPlanByPlanId = deliveryPlanByPlanId;
    }
    @Basic
    @Column(name = "OU_State", nullable = true, length = 255)
    public String getOuState() {
        return ouState;
    }

    public void setOuState(String ouState) {
        this.ouState = ouState;
    }

    @OneToMany(mappedBy = "outbound")
    public List<WaouDetails> getWaouDetailsList() {
        return waouDetailsList;
    }

    public void setWaouDetailsList(List<WaouDetails> waouDetailsList) {
        this.waouDetailsList = waouDetailsList;
    }
    @ManyToOne//可选属性optional=false,表示author不能为空。删除文章，不影响用户
    @JoinColumn(name = "yg_id")//设置在article表中的关联字段(外键)
    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @Id
    @Column(name = "OU_ID", nullable = false, precision = 0)
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getOuId() {
        return ouId;
    }

    public void setOuId(long ouId) {
        this.ouId = ouId;
    }

    @Basic
    @Column(name = "OU_DANHAO", nullable = true, length = 255)
    public String getOuDanhao() {
        return ouDanhao;
    }

    public void setOuDanhao(String ouDanhao) {
        this.ouDanhao = ouDanhao;
    }


    @Basic
    @Column(name = "OU_TIME", nullable = true)
    public Timestamp getOuTime() {
        return ouTime;
    }

    public void setOuTime(Timestamp ouTime) {
        this.ouTime = ouTime;
    }

    @Basic
    @Column(name = "OU_SHUOMING", nullable = true, length = 255)
    public String getOuShuoming() {
        return ouShuoming;
    }

    public void setOuShuoming(String ouShuoming) {
        this.ouShuoming = ouShuoming;
    }

    @Override
    public String toString() {
        return "Outbound{" +
                "ouId=" + ouId +
                ", ouDanhao='" + ouDanhao + '\'' +
                ", employee=" + employee +
                ", ouTime=" + ouTime +
                ", ouShuoming='" + ouShuoming + '\'' +
                ", waouDetailsList=" + waouDetailsList +
                ", ouState='" + ouState + '\'' +
                ", deliveryPlanByPlanId=" + deliveryPlanByPlanId +
                '}';
    }
}
